package socketmvc.core.util;

public class ClassUtils {


    public static boolean classAssignableFrom(Class<?> a,Class<?> b){
        boolean assignableFrom = b.isAssignableFrom(a);
        if (!assignableFrom){
            Class<?>[] interfaces = a.getInterfaces();
            for (Class<?> anInterface : interfaces) {
                if (b.isAssignableFrom(anInterface) || anInterface.equals(b)){
                    return true;
                }
            }
        }
        return assignableFrom;
    }

    public static void main(String[] args) {
        ClassUtils.classAssignableFrom(int.class, Number.class);
    }

}
